package com.boot.demo.boot_mybatis.controller;

import com.boot.demo.boot_mybatis.entity.User;
import com.boot.demo.boot_mybatis.service.IUserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private IUserService userService;

    @GetMapping("/list")
    @ResponseBody
    public String list() {
        List<User> userList = userService.selectAll();
        Map<String,List<User>>  map = new HashMap<>();
        map.put("userList",userList);
        return map.toString();
    }

    @PostMapping("/add")
    public String add() {
        return "add";
    }

    @PostMapping("/update")
    public String update() {
        return "update";
    }
    @PostMapping("/delete")
    public String delete() {
        return "delete";
    }


}
